package com.pet.petadoption.utils.config;



import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.pet.petadoption.utils.compont.*;

@Configuration //当程序被加载时，spring会自动实例话该类
public class MyMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("进入拦截器");
        //addPathPatterns("/**"):拦截所有的请求
        //excludePathPatterns("/user/login"):指定要放行的请求
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").
                excludePathPatterns("/user/login","/user/register","/user/upload");
        System.out.println("拦截器结尾======》");
    }
}

